<template>
  <div class="goodsList">
    <ul>
      <li v-for="item in goodsList" :key="item.id" @click="gotoDetail(item)">
        <img v-lazy="item.list_pic_url" alt="" />
        <p>{{item.name}}</p>
        <span>{{item.retail_price|formatMoney}}</span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "Goodslist",
  data() {
    return {};
  },
  props: ["goodsList"],
  components: {},
  methods: {
      gotoDetail(item){
          this.$router.push({'path':'/productDetail',query:{id:item.id}})
      }
  },
  created() {

  },
};
</script>

<style lang='less' scoped>
.goodsList{
    ul{
        text-align: center;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
            margin-top: 95px;
        li{
            width: 50%;
            img{
                width: 100%;
                display: block;
            }
            p{
                height: 35px;
                line-height: 35px;
                /* 省略号 */
                overflow: hidden;
                /*文本不会换行*/
                white-space: nowrap;
                /*当文本溢出包含元素时，以省略号表示超出的文本*/
                text-overflow: ellipsis;
            }
            span{
                display: block;
                height: 35px;
                line-height: 35px;
                color: rgb(155, 9, 9);
            }
        }
        
    }
}
</style>